import request from "@/utils/request"
// 查询角色列表
export const getRoleList = () => {
    return request({
        url: '/system/role/list',
        method: 'get'
    })
}
//查询角色详情
export const getRole = (id: number) => {
    return request({
        url: `/system/role/list/${id}`,
        method: 'get'
    })
}
//查询所有权限
export const getMenuList = () => {
    return request({
        url: "/system/role/menu",
        method: 'get'
    })
}

// 查询角色拥有菜单的权限
export const getRoleMenuList = (id: number) => {
    return request({
        url: `/system/role/menu/${id}`,
        method: 'get'
    })
}
//新增角色
export const addRole = (data: object) => {
    return request({
        url: "/system/role/list",
        method: 'post',
        data: data
    })
}
// 修改角色
export const upRole = (data: object) => {
    return request({
        url: "/system/role/put",
        method: 'put',
        data: data
    })
}
// 删除角色
export const deleteRole = (id: number) => {
    return request({
        url: `/system/role/${id}`,
        method: 'delete'
    })
}